#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <time.h>

void randomize_array (int * arr, int n) 
{
	int i, x, k;
	for (i=0; i<n; i++)
	{
		x = rand() % n;
		k=arr[i]; arr[i]=arr[x]; arr[x]=k;
	}

	/*int arr2[100], x, i;
	int m = n;

	for( i = 0; i < n; i++ )
		arr2[i] = INT_MAX;

	for( i = 0; i < n; i++ )
	{
		int j, num = -1;
		x = rand() % m;

		for (j = 0; j < n; j++ )
		{
			if( arr2[j] == INT_MAX )
				num++;
			if( num == x )
			{
				arr2[j] = arr[i];
				break;
			}
		}

		m--;
	}
	for( i = 0; i < n; i++ )
		arr[i] = arr2[i];*/
}

int main ()
{
	int arr[100], n=0, i, s;
	srand(time(NULL));
	
	printf("Vvedite massiv chisel: ");
	
	for (i=0; i<100; i++)
	{
		s=scanf ("%d", &arr[i]);
		if (s==0)
			break;
		n++;
	}

	randomize_array (arr, n);

	for (i=0; i<n; i++)
		printf ("%d ", arr[i]);
	printf("\n\n");

	system ("pause");
	return 0;
}